package service;

import dao.CategoryDao;
import entity.Category;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * Created by jifeng on 2016/12/12 0012.
 */
public class CategoryService {
    @Autowired
    private CategoryDao categoryDao;

    public CategoryDao getCategoryDao() {
        return categoryDao;
    }

    public void setCategoryDao(CategoryDao categoryDao) {
        this.categoryDao = categoryDao;
    }

    public Category addCategory(Category category){
        categoryDao.addCategory(category);
        return category;
    }
    public List findCategoryList(){
        return categoryDao.findCategoryList();
    }

    public Category findCategoryById(int id){
        return categoryDao.findCategoryById(id);
    }

    public void deleteCategory(int id){
        categoryDao.deleteCategory(id);
    }

    public void updateCate(int id,String name){
        categoryDao.updateCate(id,name);
    }
}
